package com.utils;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

import java.io.IOException;

public class Base64Util {
    /**
     * BASE64解密
     * @param key
     * @return
     */
    public static byte[] decryptBASE64(String key) {
        try {
            return new BASE64Decoder().decodeBuffer(key);
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }

    /**
     * BASE64加密
     * @param key
     * @return
     */
    public static String encryptBASE64(byte[] key){
        return new BASE64Encoder().encodeBuffer(key);
    }

}
